private function readchain(appid as string,password as string) as string'返回最长链信息
dim longchain as string
longchain=creatdata("number",-1)+creatdata("chain",0)
dim i as long,maxnum as long
maxnum=val(readfile("maxnum.txt"))
for i=1 to maxnum
    dim path as string
	path=database("chain",i)+".txt"
	dim result as string
	result=check(readfile(path),i,appid,password)
	if result="error" then
	    longchain=result
	else:
	    kill path
	endif
next
readchain=longchain
end function
private function check(file as string,chainum as long,appid as string,password as string) as string
dim lastblock as string,userdata as string,tmp() as string,maxnum as long,n as long,number as long'区块数
dim admin as string'作者的账户
admin="*****"
lastblock=123
maxnum=val(readata("number",file))
dim i as long
redim tmp(1 to maxnum) as string
userdata=creatdata(admin,12000000)
dim bar as string
n=0
for i=1 to maxnum
    bar=split(file,"<br>")(i)
	dim publickey as string,aut as string,tip as string,nextaddress as string,lasthash as string
	dim command as string
	publickey=readata("publickey",bar)
	aut=readata("aut",bar)
	command=readata("command",bar)
	tip=readata("tip",bar)
	nextaddress=readata("nextaddress",bar)
	lasthash=readata("lasthash",bar)
	if lasthash<>hash(lastblock) then
	    check="error"
		exit function
	endif
	dim p as integer,key as integer
	p=val(split(publickey,",")(0))
	key=val(split(publickey,",")(1))
	if rsajie(p,key,val(aut))<>val(hash(command+tip+nextaddress+lasthash)) then
	    check="error"
		exit function
	endif
	dim mining as boolean
	mining=false
	if val(hash(publickey+aut+command+tip+nextaddress+lasthash)) mod (2000*i)=1 then mining=true
	dim address as string
	address=hash(publickey)
	if not instr(userdata,address) then userdata=userdata+creatdata(address,0)